package com.ymm.domain.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.ymm.utils.tree.TreeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author 椰咩咩咩
 * @version 1.0-SNAPSHOT
 * @date 2023/4/3 4:09
 * @Description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RouterVo implements TreeUtils.TreeNode<Long> {
    //菜单ID
    @TableId
    private Long id;
    //菜单名称
    private String menuName;
    //菜单标签
    private String label;
    //父菜单ID
    private Long parentId;
    //路由地址
    private String path;
    //组件路径
    private String component;
    //菜单类型（0目录 1菜单 2按钮）
    private String menuType;
    //菜单状态（0显示 1隐藏）
    private String visible;
    //菜单状态（0正常 1停用）
    private String status;
    //权限标识
    private String perms;
    //菜单图标
    private String icon;

    private List<RouterVo> children;

    @Override
    public Long id() {
        return id;
    }

    @Override
    public Long parentId() {
        return parentId;
    }

    @Override
    public boolean root() {
        return id.equals(0l);
    }

    @Override
    public void setChildren(List<? extends TreeUtils.TreeNode<Long>> children) {
        this.children = (List<RouterVo>) children;
    }

    @Override
    public List<? extends TreeUtils.TreeNode<Long>> getChildren() {
        return this.children;
    }
}
